function y = SinSynth(amps, freqs, phases, nFrames, samPerFra, hopSamples,...
    winType)
%SINSYNTH resynthesize the audio using sin waves
%   waves are discribed by amplitudes, frequencies and phases
%   the method of resynthesis is the OLA without
%   interpolation between frames

window_gen = str2func(winType);
w = window_gen(samPerFra);

y = zeros((nFrames-1)*hopSamples + samPerFra, 1);
for frameIdx=1:nFrames
   
    yIdx = 1:samPerFra;
    
    yFrame = SynthWithinFrame(amps(:,frameIdx), freqs(:,frameIdx), phases(:,frameIdx), samPerFra);
    
    % Overlap-add
    y((frameIdx-1)*hopSamples+yIdx) = y((frameIdx-1)*hopSamples+yIdx) + yFrame'.*w;

end

end

